package com.my.test.ctrl;

import java.util.Date;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.my.test.service.TestService;

//@RestController
@Controller
@EnableAutoConfiguration
public class HelloCtrl {

	@Autowired
	private TestService testService;
	@RequestMapping("/")
    String home() {
        return "Hello World! "+testService.getName("hzb");
    }

    @RequestMapping("/now")
    String hehe() {
        return "现在时间：" + (new Date()).toLocaleString()+testService.getName("hzb");
    }
    /**
     * 返回html模板.
     */
    @RequestMapping("/helloHtml")
    public String helloHtml(Map<String,Object> map){
        map.put("hello","from TemplateController.helloHtml");
        return"/helloHtml";
    }
}
